#include<iostream>
#include<cstring>
using namespace std;
typedef long long LL;
const int N = 1e5 + 10, M = 2 * N;
const LL mod = 1e9 + 7;
int n;
int h[N], e[M], ne[M], idx;
int sz[N];
LL f[N][2];
void add(int a, int b)
{
	e[idx] = b, ne[idx] = h[a], h[a] = idx++;
}

void dfs(int u, int fa)
{
	f[u][1] = 1;
	f[u][0] = 1;
	for (int i = h[u]; ~i; i = ne[i]) {
		int j = e[i];
		if (j == fa)continue;
		dfs(j, u);
		f[u][0] *= f[j][1];
		f[u][0] %= mod;
		f[u][1] *= (f[j][0] + f[j][1]);
		f[u][1] %= mod;
	}
}

int main()
{
	cin >> n;
	memset(h, -1, sizeof(h));
	for (int i = 0; i < n - 1; i++) {
		int u, v;
		cin >> u >> v;
		add(u, v);
		add(v, u);
	}
	dfs(1, 0);
	cout << (f[1][0] % mod + f[1][1] % mod) % mod << endl;
	return 0;
}	